<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

	<head>
		<meta charset="UTF-8">
		<title>公告管理</title>
		<link href="../css/bootstrap.min.css" rel="stylesheet">
		<link href="../fonts/css/font-awesome.css" rel="stylesheet">
		<link href="../css/animate.css" rel="stylesheet">
		<link href="../css/summernote.css" rel="stylesheet">
		<link href="../css/summernote-bs3.css" rel="stylesheet">
		<link href="../css/style.css" rel="stylesheet">
		<link rel="stylesheet" href="../css/sweetalert.css" />
		<script type="text/javascript" src="../js/sweetalert.min.js" ></script>
	</head>

	<body>
		<div id="wrapper">
			<!--左侧导航栏-->
			<nav class="navbar-default navbar-static-side" role="navigation">
				<div class="sidebar-collapse">
					<ul class="nav metismenu" id="side-menu">
						<li>
							<a href="#"><i class="fa fa-th-large"></i> <span class="nav-label">发帖管理</span> <span class="fa arrow"></span></a>
							<ul class="nav nav-second-level collapse">
								<li>
									<a href="findingadmin.jsp">寻帖审核</a>
								</li>
								<li>
									<a href="main.jsp">失物审核</a>
								</li>
							</ul>
						</li>
						<li>
							<a href="#"><i class="fa fa-th-large"></i> <span class="nav-label">信息管理</span> <span class="fa arrow"></span></a>
							<ul class="nav nav-second-level collapse">
								<li>
									<a href="locationadmin.jsp">招领点管理</a>
								</li>
								<li>
									<a href="charts.jsp">图表展示</a>
								</li>
							</ul>
						</li>
						<li>
							<a href="#"><i class="fa fa-th-large"></i> <span class="nav-label">管理</span> <span class="fa arrow"></span></a>
							<ul class="nav nav-second-level collapse">
								<li>
									<a href="editor.jsp">发布公告</a>
								</li>
								<li>
									<a href="data.jsp">数据备份</a>
								</li>
							</ul>
						</li>
					</ul>

				</div>
			</nav>
			<div id="page-wrapper" class="gray-bg">
				<div class="row border-bottom">
					<nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0">
						<div class="navbar-header">
							<a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="#"><i class="fa fa-bars"></i> </a>
						</div>
						<ul class="nav navbar-top-links navbar-right">
							<li>
								<span class="m-r-sm text-muted welcome-message">欢迎来到系统管理员</span>
							</li>
							<li>
								<a href="login.jsp">
									<i class="fa fa-sign-out"></i> 注销
								</a>
							</li>
						</ul>
					</nav>
				</div>
				<div class="row wrapper border-bottom white-bg page-heading">
					
                      <div class="tab-content">
							<div id="tab-1" class="tab-pane active">
								<div class="panel-body">
									<div class="col-sm-12">
										<div class="ibox float-e-margins">
											<div class="click2edit wrapper">
												<h3>请编辑公告</h3>
												
											</div>
											<button id="edit" class="btn btn-primary btn-xs m-l-sm" onclick="edit()" type="button">编辑</button>
											<button id="save" class="btn btn-primary  btn-xs" onclick="save()" type="button">发布</button>
											
										</div>
									</div>
								</div>
							</div>
							
						</div>      
            
					
				</div>
			</div>
		</div>

		<script src="../js/jquery.js"></script>
		<script src="../js/bootstrap.min.js"></script>
		<script src="../js/jquery.metisMenu.js"></script>
		<script src="../js/jquery.slimscroll.min.js"></script>

		<!-- Custom and plugin javascript -->
		<script src="../js/inspinia.js"></script>
		<script src="../js/pace.min.js"></script>
		<script type="text/javascript" src="../js/summernote.min.js" ></script>
		<script>
			 $(document).ready(function(){

            $('.summernote').summernote();

       });
        var edit = function() {
            $('.click2edit').summernote({focus: true});
        };
        var save = function() {
        	 var aHTML = $('.click2edit').code(); //save HTML If you need(aHTML: array).
             aHTML = aHTML.replace(/^\s+|\s+$/g,"");
        
        	$.ajax({
        		type:"post",
        		url:"../admin/inserttitle.action",
        		dataType:"json",
        		data:{"Content":aHTML},
        		success:function(data){
        			if(data==1){
        			swal("成功!", "添加成功", "success");
        			}else if(data==0){
        				swal("取消", "添加失败 :)", "error");	
        			}
        		}
        	})
           
            $('.click2edit').destroy();
        };
			
		</script>
	</body>

</html>